// 封装获取频道列表的逻辑
import {useState,useEffect} from "react"
import {getChannelsList} from "@/api/article.js"

function useChannel() {
    // 获取频道列表
    const [channelsList, setChannelsList] = useState([])

    useEffect(() => {
        const getChannels = async () => {
            const res = await getChannelsList()
            setChannelsList(res.data.data.channels)
        }
        getChannels()
    }, [])

    return {
        channelsList
    }
}

export {
    useChannel
}